﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace iNet.Media.Imaging
{
	/// <summary>
	/// GIF 影像解碼工作工廠。
	/// </summary>
	public class GifImageDecodeTaskFactory : FastImageDecodeTaskFactory
	{
		#region 建構子
		/// <summary>
		/// 初始化新的 GifImageDecodeTaskFactory 執行個體。
		/// </summary>
		public GifImageDecodeTaskFactory()
			: base("GIF Image DecodeTask Factory", ImageFormats.Gif)
		{ }
		#endregion
		#region CreateDecodeTask
		public override MediaDecodeTask CreateDecodeTask(MediaStorage source)
		{
			return new GifImageDecodeTask(source);
		}
		#endregion
		#region IsSupportedFormatCore
		protected override bool IsSupportedFormatCore(byte[] mediaHeader)
		{
			return (mediaHeader.Length >= 3 && mediaHeader[0] == 'G' && mediaHeader[1] == 'I' && mediaHeader[2] == 'F');
		}
		#endregion
		#region MediaHeaderSize
		public override int MediaHeaderSize
		{
			get 
			{
				return 3;
			}
		}
		#endregion
	}
}
